package com.travel.service.impl;

import java.util.List;

import com.travel.dao.ScenicDao;
import com.travel.dao.impl.ScenicDaoImpl;
import com.travel.entity.Scenic;
import com.travel.service.ScenicService;
import com.travel.util.PageInfo;
/**
 * 景点业务层实现层
 * @author huangyanbin 
 *
 */
public class ScenicServiceImpl implements ScenicService {

	private ScenicDao scenicDao = new ScenicDaoImpl();

	@Override
	public List<Scenic> find() {
		return scenicDao.find();
	}

	@Override
	public boolean insertScenic(Scenic scenic) {
		int insertScenic = scenicDao.insertScenic(scenic);
		return insertScenic > 0 ? true : false;
	}

	@Override
	public boolean updateScenic(Scenic scenic) {
		int updateScenic = scenicDao.updateScenic(scenic);
		return updateScenic > 0 ? true : false;
	}

	@Override
	public boolean deleteId(int deleteId) {
		int deleteId2 = scenicDao.deleteId(deleteId);
		return deleteId2 ==1?true :false;
	}

	@Override
	public List<Scenic> getByScenicName(String scenicName) {
		return scenicDao.findByScenicName(scenicName);
	}

	@Override
	public PageInfo<Scenic> findByPage(int pageNum, int pageSize) {
		return scenicDao.findByPage(pageNum, pageSize);
	}

	@Override
	public PageInfo<Scenic> findByPage(int pageNum, int pageSize, String scenicName) {
		if (pageNum <= 0) {
			pageNum = 1;
		}
		if (pageSize <= 0) {
			pageSize = 10;
		}
		return scenicDao.findByPage(pageNum, pageSize, scenicName);
	}

	@Override
	public Scenic getByScenicId(int scenicId) {
		return scenicDao.findByScenicId(scenicId);
	}

	@Override
	public List<Scenic> getScenicByScenicName(String scenicName) {
		return scenicDao.getScenicByScenicName(scenicName);
	}

	@Override
	public List<Scenic> recommendScenic() {
		List<Scenic> list = scenicDao.recommendScenic();
		return list;
	}
}
